<template>
  <div style="background-color:#fff;padding:10px;">
    <div><el-button @click="showDialog=true">选择文件</el-button></div>
    <div>
      <img :src="file.uri" v-for="(file,index) in choiceFiles" :key="index" />
    </div>

    <el-dialog :visible.sync="showDialog">
      <choice-box :show-dialog="showDialog" @cancel="showDialog=false" @success="fileCallback"></choice-box>
    </el-dialog>
  </div>
</template>

<script>
  import choiceBox from './subs/choiceBox'
  import Vue from 'vue'
  export default {
    components:{choiceBox},
    name: "choice-files",
    data() {
      return {
        showDialog:false,
        choiceFiles:[]
      }
    },
    created() {
    },
    methods: {
      fileCallback(files){
        this.showDialog = false
        console.log(files)
        files.forEach(file=>{
          this.choiceFiles.push(file)
        })
      }
    }
  }
</script>

<style lang="scss">

</style>
